package cn.sdx.ssm.controller;

import cn.sdx.ssm.pojo.Dept;
import cn.sdx.ssm.pojo.Msg;
import cn.sdx.ssm.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author sdx
 * @create 2021-05-12 2:03
 */
@Controller
public class DeptController {
    @Autowired
    private DeptService deptService;

    /**
     * 获取所有部门信息
     */
    @ResponseBody
    @RequestMapping("/depts")
    public Msg getDepts(){
        List<Dept> depts = deptService.getAllDept();
        return Msg.success().add("depts",depts);
    }
}
